/*
 * tms系统 首页
 */
var url = '', jsonData = '';
$(function(){
	
	//initDate();
	loadData();
});


function initDate(){
	$('.date-icon a').click(function(){
		zIndex = $('#date-all').css('z-index');
		if(zIndex == -1){
			$('#date-all').css('z-index', 0);	
			$('.date-show').slideDown(300);
		}
		if(zIndex == 0){
			$('.date-show').slideUp(200);
			window.setTimeout("$('#date-all').css('z-index', -1)", 200);
		}
	});
}


function loadData(){
	/**
	 * 饼图
	 */
	loadDegree();
	loadSex();
	loadAge();
	loadWorkExperience();
	
	/**
	 * 入职/离职 人数/比率 柱状图  折线图
	 */
	loadEntryAndLeavePeople();
	
	/**
	 * 员工增长率
	 */
	loadEmployeeGrowth();
	/**
	 * 地域分布
	 */
	loadArealDistribution();
	/**
	 * HC指标
	 */
	loadHCTarget();
	/**
	 * HC周报
	 */
	loadHCWeeklyReports();
	/**
	 * 短期离职预警  he 下方表格
	 */
	/*loadShortLeaveOfficeEmployee();*/
	loadShortLeaveOfficeEmployeeTable();
	/**
	 * 组织结构展示 树形图   树形表
	 */
	loadOrganizationStructureShow();
	/**
	 * 年度薪酬总额增长率
	 */
	loadAnnualGrowthRateOfTotalCompensation();
	/**
	 * 薪资总览
	 */
	loadPayOverview();
	/**
	 * 部门员工信息
	 */
	loadDepartmentEmployeeInformation();
}

function commonAjax(){
	var result = '';
	$.ajax({
		type: 'GET',
		//data: jsonData,
	    url: url,
	    async: false,
	    dataType:"json",
	    success: function(data){
	    	result = data;
	    },
	    error: function(){
	    }
	});
	return result;
}

function commonAjaxData(){
	var result = '';
	$.ajax({
		type: 'GET',
		data: jsonData,
	    url: url,
	    async: false,
	    dataType:"json",
	    success: function(data){
	    	result = data;
	    },
	    error: function(){
	    }
	});
	return result;
}


function loadDegree(){
	url = ctx + '/show/degree';
	//jsonData = '';	//jsonData = {startTime:startTime,endTime:endTime};
	var  returnData= commonAjax();
	initPieChart(returnData.title,returnData.degree,document.getElementById('degreeMain'));
	
}

function loadAge(){
	url = ctx + '/show/age';
	//jsonData = '';	//jsonData = {startTime:startTime,endTime:endTime};
	var  returnData= commonAjax();
	initPieChart(returnData.title,returnData.age,document.getElementById('ageMain'));
}

function loadSex(){
	url = ctx + '/show/gender';
	//jsonData = '';	//jsonData = {startTime:startTime,endTime:endTime};
	var  returnData= commonAjax();
	initPieChart(returnData.title,returnData.gender,document.getElementById('sexMain'));
}

function loadWorkExperience(){
	url = ctx + '/show/workExperience';
	//jsonData = '';	//jsonData = {startTime:startTime,endTime:endTime};
	var  returnData= commonAjax();
	initPieChart(returnData.title,returnData.workExperience,document.getElementById('workExperienceMain'));
}

/*
 * 入职率、离职率
 */
function loadEntryAndLeavePeople() {
	url = ctx + '/employeeController/entryLeave';
	var departmentId = $('#departmentId').val();
	var startTime = $('#startEntryAndLeaveOffice').html();
	var endTime = $('#endEntryAndLeaveOffice').html();
	
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime};
	var  returnData= commonAjaxData(jsonData);
	initStackBarChart(returnData.title,returnData.data,returnData.dates,returnData.name1,returnData.name2,document.getElementById('entryAndLeavePeopleMain'));
	
}


/*
 * 员工增长率
 */
function loadEmployeeGrowth() {
	
	url = ctx + '/employeeRRController/employeeGrowth';
	
	var departmentId = $('#departmentId').val();
	var startTime = $('#startEmployeeGrowth').html();
	var endTime = $('#endEmployeeGrowth').html();
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime};
	var  returnData= commonAjaxData(jsonData);
	initLineChart(returnData.title,returnData.data,returnData.dates,returnData.name1,document.getElementById('employeeGrowthMain'));
	
}

function loadArealDistribution() {
	url = ctx + '/area/show';
//jsonData = '';	//jsonData = {startTime:startTime,endTime:endTime};
	var  returnData= commonAjax();
	//alert("123"+returnData.area.beijing);
	//initMapChart(returnData.area,document.getElementById('arealDistributionMain'));
	initMap(returnData.area,document.getElementById('arealDistributionMain'));
	
}
/*
 * HC指标
 */
function loadHCTarget() {
	url = ctx + '/show/entryType';
	 
	var departmentId = $('#departmentId').val();
	var startTime = $('#startHCTarget').html();
	var endTime = $('#endHCTarget').html();
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime};
	var  returnData= commonAjaxData(jsonData);
	
	initBarChart(returnData.title,returnData.data,returnData.dates,returnData.name1,document.getElementById('HCTargetMain'));
	
}
/*
 * HC周报
 */
function loadHCWeeklyReports() {
	url = ctx + '/show/HCWeek';
	var departmentId = $('#departmentId').val();
	var startTime = $('#startHCWeeklyReports').html();
	var endTime = $('#endHCWeeklyReports').html();
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime};
	//jsonData = {startTime:startTime,endTime:endTime};
	var  returnData= commonAjaxData(jsonData);
	initLineChart(returnData.title,returnData.data,returnData.dates,returnData.name1,document.getElementById('HCWeeklyReportsMain'));
	
}

function loadShortLeaveOfficeEmployee() {
	initLineChart("title","data","date",document.getElementById('shortLeaveOfficeEmployeeMain'));
	
}

function loadShortLeaveOfficeEmployeeTable(){
	url = ctx + '/employeeDimissionController/shortDimissionEmployee';
	
	var departmentId = $('#departmentId').val();
	var pageNum =0;
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initShortLeaveOfficeEmployeeTable(returnData.data);
	$('#shortLeaveOfficeEmployee_tbody').html(tbodyHtml);
	
	/*
	 * 分页数据的设置
	 */
	
	$('#previousShortLeaveOfficeEmployeeInput').val(returnData.prePage);
	$('#nextShortLeaveOfficeEmployeeInput').val(returnData.nextPage);
	$('#lastShortLeaveOfficeEmployeeInput').val(returnData.lastPage);
	
	$('#curPageShortLeaveOfficeEmployee').html(returnData.curPage+1);
	$('#totalNumberShortLeaveOfficeEmployee').html(returnData.totalNumber);
	$('#totalPageShortLeaveOfficeEmployee').html(returnData.totalPage);
	$('#pageSizeShortLeaveOfficeEmployee').html(returnData.pageSize);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#previousShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#firstShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#previousShortLeaveOfficeEmployee').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#lastShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#nextShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#lastShortLeaveOfficeEmployee').removeAttr("disabled");
	}
	
}

function loadOrganizationStructureShow() {
	url = ctx + '/organizationController/showOrganization';
	var departmentId = $('#departmentId').val();
	
	jsonData = {departmentId:departmentId};
	
	var returnData= commonAjaxData(jsonData);
	initTreeChart(returnData,document.getElementById('organizationStructureShowMain'));
	//initForce(returnData,document.getElementById('organizationStructureShowMain'));
}

function loadAnnualGrowthRateOfTotalCompensation() {
	
	url = ctx + '/employeeRRController/salaryGrowt';
	
	var departmentId = $('#departmentId').val();
	var startTime = $('#startAnnualGrowthRateOfTotalCompensation').html();
	var endTime = $('#endAnnualGrowthRateOfTotalCompensation').html();
	
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime};
	var returnData= commonAjaxData(jsonData);
	//var returnData= commonAjax();
	
	initStackBarChart(returnData.title,returnData.data,returnData.dates,returnData.name1,returnData.name2,document.getElementById('annualGrowthRateOfTotalCompensationMain'));
	
}

function loadPayOverview() {
	url = ctx + '/employeeDimissionController/departmentWages';
	
	var departmentId = $('#departmentId').val();
	var startTime = $('#startPayOverview').html();
	var endTime = $('#endPayOverview').html();
	var pageNum = "0";
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime,pageNum:pageNum};
	
	var returnData= commonAjaxData(jsonData);
	tbodyHtml = initPayOverviewHtml(returnData.data);
	
	$('#PayOverview_tbody').html(tbodyHtml);
	
	
	/*
	 * 分页数据设置
	 */
	$('#previousPayOverviewInput').val(returnData.prePage);
	$('#nextPayOverviewInput').val(returnData.nextPage);
	$('#lastPayOverviewInput').val(returnData.lastPage);
	
	$('#curPagePayOverview').html(returnData.curPage+1);
	$('#totalNumberPayOverview').html(returnData.totalNumber);
	$('#totalPagePayOverview').html(returnData.totalPage);
	$('#pageSizePayOverview').html(returnData.pageSize);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstPayOverview').attr("disabled","disabled");
		$('#previousPayOverview').attr("disabled","disabled");
	}else {
		$('#firstPayOverview').removeAttr("disabled");
		$('#previousPayOverview').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextPayOverview').attr("disabled","disabled");
		$('#lastPayOverview').attr("disabled","disabled");
	}else {
		$('#nextPayOverview').removeAttr("disabled");
		$('#lastPayOverview').removeAttr("disabled");
	}
	
};


/**
 * 部门员工信息
 */
function loadDepartmentEmployeeInformation(){
	url = ctx + '/talentInformationController/talentInformation';
	var departmentId = $('#departmentId').val();
	//jsonData = {departmentId:departmentId};
	var pageNum = "0";
	
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initDepartmentEmployeeInformationHtml(returnData.data);
	$('#departmentEmployeeInformation_tbody').html(tbodyHtml);
	
	/*
	 * 分页数据设置
	 */
	$('#previousDepartmentEmployeeInformationInput').val(returnData.prePage);
	$('#nextDepartmentEmployeeInformationInput').val(returnData.nextPage);
	$('#lastDepartmentEmployeeInformationInput').val(returnData.lastPage);
	
	$('#curPageDepartmentEmployeeInformation').html(returnData.curPage+1);
	$('#totalNumberDepartmentEmployeeInformation').html(returnData.totalNumber);
	$('#totalPageDepartmentEmployeeInformation').html(returnData.totalPage);
	$('#pageSizeDepartmentEmployeeInformation').html(returnData.pageSize);
	   
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#previousDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#firstDepartmentEmployeeInformation').removeAttr("disabled");
		$('#previousDepartmentEmployeeInformation').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#lastDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#nextDepartmentEmployeeInformation').removeAttr("disabled");
		$('#lastDepartmentEmployeeInformation').removeAttr("disabled");
	}
	
};


function initDepartmentEmployeeInformationHtml(data){
	var returnHtml = '';
	
	if (data.length == 0)
		returnHtml = '<tr><td colspan="5">暂无数据</td></tr>';
	else
		$.each(data, function(index, item) {
			
			returnHtml += "<tr>"
				+ "<td>" +item.department+ "</td>"
				+ "<td>"+item.name+"</td>" 
				+ "<td>" + item.job_number+ "</td>" 
				+ "<td>"+ item.gender + "</td>" 
				+ "<td>"+ item.job_name + "</td>"
				+ "<td>"+ item.degree_illustration + "</td>"
				+ "<td>"+ item.contact_information + "</td>"
				+ "<td>"+ item.graduate_school + "</td>"
				+ "<td>"+ item.entry_location + "</td>"
				//+ "<td><a href='/employeePage'>查看</a></td></tr>'";
				+ "<td><a href='employeeDetailsController/talentInformationDetails?jobNumber="+item.job_number+"'>查看</a></td></tr>'";
			
		});
	
	
	return returnHtml;
}

function initPayOverviewHtml(data){
	var returnHtml = '';
	
	if (data.length == 0)
		returnHtml = '<tr><td colspan="5">暂无数据</td></tr>';
	else
		$.each(data, function(index, item) {

			returnHtml += "<tr>"
					+ "<td style='text-align: center'>" + item.depName + "</td>"
					+ "<td>"+item.depNum+"</td>" 
					+ "<td>" + item.salaryTotal+ "</td>" 
					+ "<td>"+ item.salaryAve + "</td>" 
					+ "<td>"+ item.socialSecurityBenefitsCostTotal + "</td>"
					+ "<td>"+ item.humanResourceCost + "</td></tr>";
		});

	
	return returnHtml;
}

function initShortLeaveOfficeEmployeeTable(data){
	var returnHtml = '';
	
	if (data.length == 0)
	returnHtml = '<tr><td colspan="5">暂无数据</td><td><a href="#">查看</a></td></tr>';
else
	$.each(data, function(index, item) {
		
		returnHtml += "<tr>"
				+ "<td style='text-align: center'>" + item.name + "</td>"
				+ "<td>"+item.gender+"</td>" 
				+ "<td>" + item.department+ "</td>" 
				+ "<td>"+ item.degree + "</td>" 
				+ "<td>"+ item.graduate_school + "</td>"
				+ "<td>"+ item.household_location + "</td>"
				+ "<td>"+ item.salary
				+ "<td><a href='employeeDetailsController/talentInformationDetails?jobNumber="+item.job_number+"'>查看</a></td></tr>'";
		
	});
	
	
	return returnHtml;
}


/**
 * 短期离职员工 分页功能
 */
/*
 * 短期离职员工 分页功能    首页按钮
 */
function firstShortLeaveOfficeEmployee(){
	url = ctx + '/employeeDimissionController/shortDimissionEmployee';
	
	var departmentId = $('#departmentId').val();
	var pageNum=0;
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initShortLeaveOfficeEmployeeTable(returnData.data);
	$('#shortLeaveOfficeEmployee_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousShortLeaveOfficeEmployeeInput').val(returnData.prePage);
	$('#nextShortLeaveOfficeEmployeeInput').val(returnData.nextPage);
	
	$('#curPageShortLeaveOfficeEmployee').html(returnData.curPage+1);
	$('#totalNumberShortLeaveOfficeEmployee').html(returnData.totalNumber);
	$('#totalPageShortLeaveOfficeEmployee').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#previousShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#firstShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#previousShortLeaveOfficeEmployee').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#lastShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#nextShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#lastShortLeaveOfficeEmployee').removeAttr("disabled");
	}
	
}

/*
 * 短期离职员工 分页功能    上一页按钮
 */
function previousShortLeaveOfficeEmployee(){
	url = ctx + '/employeeDimissionController/shortDimissionEmployee';
	
	var departmentId = $('#departmentId').val();
	
	var pageNum= $('#previousShortLeaveOfficeEmployeeInput').val();
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initShortLeaveOfficeEmployeeTable(returnData.data);
	$('#shortLeaveOfficeEmployee_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousShortLeaveOfficeEmployeeInput').val(returnData.prePage);
	$('#nextShortLeaveOfficeEmployeeInput').val(returnData.nextPage);
	
	$('#curPageShortLeaveOfficeEmployee').html(returnData.curPage+1);
	$('#totalNumberShortLeaveOfficeEmployee').html(returnData.totalNumber);
	$('#totalPageShortLeaveOfficeEmployee').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#previousShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#firstShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#previousShortLeaveOfficeEmployee').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#lastShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#nextShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#lastShortLeaveOfficeEmployee').removeAttr("disabled");
	}
	
	
	
}

/*
 * 短期离职员工 分页功能    下一页按钮
 */
function nextShortLeaveOfficeEmployee(){
	url = ctx + '/employeeDimissionController/shortDimissionEmployee';
	
	var departmentId = $('#departmentId').val();
	
	var pageNum= $('#nextShortLeaveOfficeEmployeeInput').val();
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initShortLeaveOfficeEmployeeTable(returnData.data);
	$('#shortLeaveOfficeEmployee_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousShortLeaveOfficeEmployeeInput').val(returnData.prePage);
	$('#nextShortLeaveOfficeEmployeeInput').val(returnData.nextPage);
	
	$('#curPageShortLeaveOfficeEmployee').html(returnData.curPage+1);
	$('#totalNumberShortLeaveOfficeEmployee').html(returnData.totalNumber);
	$('#totalPageShortLeaveOfficeEmployee').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#previousShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#firstShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#previousShortLeaveOfficeEmployee').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#lastShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#nextShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#lastShortLeaveOfficeEmployee').removeAttr("disabled");
	}
	
}

/*
 * 短期离职员工 分页功能   尾页按钮
 */
function lastShortLeaveOfficeEmployee(){
	url = ctx + '/employeeDimissionController/shortDimissionEmployee';
	
	var departmentId = $('#departmentId').val();
	
	var pageNum= $('#lastShortLeaveOfficeEmployeeInput').val();
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initShortLeaveOfficeEmployeeTable(returnData.data);
	$('#shortLeaveOfficeEmployee_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousShortLeaveOfficeEmployeeInput').val(returnData.prePage);
	$('#nextShortLeaveOfficeEmployeeInput').val(returnData.nextPage);
	
	$('#curPageShortLeaveOfficeEmployee').html(returnData.curPage+1);
	$('#totalNumberShortLeaveOfficeEmployee').html(returnData.totalNumber);
	$('#totalPageShortLeaveOfficeEmployee').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#previousShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#firstShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#previousShortLeaveOfficeEmployee').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextShortLeaveOfficeEmployee').attr("disabled","disabled");
		$('#lastShortLeaveOfficeEmployee').attr("disabled","disabled");
	}else {
		$('#nextShortLeaveOfficeEmployee').removeAttr("disabled");
		$('#lastShortLeaveOfficeEmployee').removeAttr("disabled");
	}
}


/**
 * 部门员工信息 分页功能-----------------------------------
 */
/*
 * 部门员工信息    首页按钮
 */
function firstDepartmentEmployeeInformation(){
	url = ctx + '/talentInformationController/talentInformation';
	
	var departmentId = $('#departmentId').val();
	var pageNum=0;
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initDepartmentEmployeeInformationHtml(returnData.data);
	$('#departmentEmployeeInformation_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousDepartmentEmployeeInformationInput').val(returnData.prePage);
	$('#nextDepartmentEmployeeInformationInput').val(returnData.nextPage);
	
	$('#curPageDepartmentEmployeeInformation').html(returnData.curPage+1);
	$('#totalNumberDepartmentEmployeeInformation').html(returnData.totalNumber);
	$('#totalPageDepartmentEmployeeInformation').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#previousDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#firstDepartmentEmployeeInformation').removeAttr("disabled");
		$('#previousDepartmentEmployeeInformation').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#lastDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#nextDepartmentEmployeeInformation').removeAttr("disabled");
		$('#lastDepartmentEmployeeInformation').removeAttr("disabled");
	}
	
}

/*
 *  部门员工信息 分页功能    上一页按钮
 */
function previousDepartmentEmployeeInformation(){
	url = ctx + '/talentInformationController/talentInformation';
	
	var departmentId = $('#departmentId').val();
	
	var pageNum= $('#previousDepartmentEmployeeInformationInput').val();
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initDepartmentEmployeeInformationHtml(returnData.data);
	$('#departmentEmployeeInformation_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousDepartmentEmployeeInformationInput').val(returnData.prePage);
	$('#nextDepartmentEmployeeInformationInput').val(returnData.nextPage);
	
	$('#curPageDepartmentEmployeeInformation').html(returnData.curPage+1);
	$('#totalNumberDepartmentEmployeeInformation').html(returnData.totalNumber);
	$('#totalPageDepartmentEmployeeInformation').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#previousDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#firstDepartmentEmployeeInformation').removeAttr("disabled");
		$('#previousDepartmentEmployeeInformation').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#lastDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#nextDepartmentEmployeeInformation').removeAttr("disabled");
		$('#lastDepartmentEmployeeInformation').removeAttr("disabled");
	}
	
}

/*
 *  部门员工信息 分页功能    下一页按钮
 */
function nextDepartmentEmployeeInformation(){
	url = ctx + '/talentInformationController/talentInformation';
	
	var departmentId = $('#departmentId').val();
	
	var pageNum= $('#nextDepartmentEmployeeInformationInput').val();
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initDepartmentEmployeeInformationHtml(returnData.data);
	$('#departmentEmployeeInformation_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousDepartmentEmployeeInformationInput').val(returnData.prePage);
	$('#nextDepartmentEmployeeInformationInput').val(returnData.nextPage);
	
	$('#curPageDepartmentEmployeeInformation').html(returnData.curPage+1);
	$('#totalNumberDepartmentEmployeeInformation').html(returnData.totalNumber);
	$('#totalPageDepartmentEmployeeInformation').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#previousDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#firstDepartmentEmployeeInformation').removeAttr("disabled");
		$('#previousDepartmentEmployeeInformation').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#lastDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#nextDepartmentEmployeeInformation').removeAttr("disabled");
		$('#lastDepartmentEmployeeInformation').removeAttr("disabled");
	}
	
}

/*
 *  部门员工信息 分页功能   尾页按钮
 */
function lastDepartmentEmployeeInformation(){
	url = ctx + '/talentInformationController/talentInformation';
	
	var departmentId = $('#departmentId').val();
	
	var pageNum= $('#lastDepartmentEmployeeInformationInput').val();
	jsonData = {departmentId:departmentId,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initDepartmentEmployeeInformationHtml(returnData.data);
	$('#departmentEmployeeInformation_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousDepartmentEmployeeInformationInput').val(returnData.prePage);
	$('#nextDepartmentEmployeeInformationInput').val(returnData.nextPage);
	
	$('#curPageDepartmentEmployeeInformation').html(returnData.curPage+1);
	$('#totalNumberDepartmentEmployeeInformation').html(returnData.totalNumber);
	$('#totalPageDepartmentEmployeeInformation').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#previousDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#firstDepartmentEmployeeInformation').removeAttr("disabled");
		$('#previousDepartmentEmployeeInformation').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#lastDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#nextDepartmentEmployeeInformation').removeAttr("disabled");
		$('#lastDepartmentEmployeeInformation').removeAttr("disabled");
	}
	
}

function turnSelect() {
	url = ctx + '/talentInformationController/searchTalent';
	var keyWord = $('#employeeSelectInput').val();
	var departmentId = $('#departmentId').val();
	var pageNum = "0";
	
	jsonData = {departmentId:departmentId,keyWord:keyWord,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initDepartmentEmployeeInformationHtml(returnData.data);
	$('#departmentEmployeeInformation_tbody').html(tbodyHtml);
	
	/*
	 * 分页数据设置
	 */
	$('#previousDepartmentEmployeeInformationInput').val(returnData.prePage);
	$('#nextDepartmentEmployeeInformationInput').val(returnData.nextPage);
	$('#lastDepartmentEmployeeInformationInput').val(returnData.lastPage);
	
	$('#curPageDepartmentEmployeeInformation').html(returnData.curPage+1);
	$('#totalNumberDepartmentEmployeeInformation').html(returnData.totalNumber);
	$('#totalPageDepartmentEmployeeInformation').html(returnData.totalPage);
	$('#pageSizeDepartmentEmployeeInformation').html(returnData.pageSize);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#previousDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#firstDepartmentEmployeeInformation').removeAttr("disabled");
		$('#previousDepartmentEmployeeInformation').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextDepartmentEmployeeInformation').attr("disabled","disabled");
		$('#lastDepartmentEmployeeInformation').attr("disabled","disabled");
	}else {
		$('#nextDepartmentEmployeeInformation').removeAttr("disabled");
		$('#lastDepartmentEmployeeInformation').removeAttr("disabled");
	}
	
}


/**
 * 部门薪资总览 分页功能-----------------------------------
 */
/*
 * 部门薪资总览    首页按钮
 */
function firstPayOverview(){
	url = ctx + '/employeeDimissionController/departmentWages';
	
	var departmentId = $('#departmentId').val();
	var startTime = $('#startPayOverview').html();
	var endTime = $('#endPayOverview').html();
	var pageNum=0;
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initPayOverviewHtml(returnData.data);
	$('#PayOverview_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousPayOverviewInput').val(returnData.prePage);
	$('#nextPayOverviewInput').val(returnData.nextPage);
	
	$('#curPagePayOverview').html(returnData.curPage+1);
	$('#totalNumberPayOverview').html(returnData.totalNumber);
	$('#totalPagePayOverview').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstPayOverview').attr("disabled","disabled");
		$('#previousPayOverview').attr("disabled","disabled");
	}else {
		$('#firstPayOverview').removeAttr("disabled");
		$('#previousPayOverview').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextPayOverview').attr("disabled","disabled");
		$('#lastPayOverview').attr("disabled","disabled");
	}else {
		$('#nextPayOverview').removeAttr("disabled");
		$('#lastPayOverview').removeAttr("disabled");
	}
}

/*
 *  部门薪资总览 分页功能    上一页按钮
 */
function previousPayOverview(){
	url = ctx + '/employeeDimissionController/departmentWages';
	
	var departmentId = $('#departmentId').val();
	
	var pageNum= $('#previousPayOverviewInput').val();
	
	var startTime = $('#startPayOverview').html();
	var endTime = $('#endPayOverview').html();
	
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime,pageNum:pageNum};

	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initPayOverviewHtml(returnData.data);
	$('#PayOverview_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousPayOverviewInput').val(returnData.prePage);
	$('#nextPayOverviewInput').val(returnData.nextPage);
	
	$('#curPagePayOverview').html(returnData.curPage+1);
	$('#totalNumberPayOverview').html(returnData.totalNumber);
	$('#totalPagePayOverview').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstPayOverview').attr("disabled","disabled");
		$('#previousPayOverview').attr("disabled","disabled");
	}else {
		$('#firstPayOverview').removeAttr("disabled");
		$('#previousPayOverview').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextPayOverview').attr("disabled","disabled");
		$('#lastPayOverview').attr("disabled","disabled");
	}else {
		$('#nextPayOverview').removeAttr("disabled");
		$('#lastPayOverview').removeAttr("disabled");
	}
	
}

/*
 *  部门薪资总览 分页功能    下一页按钮
 */
function nextPayOverview(){
	url = ctx + '/employeeDimissionController/departmentWages';
	
	var departmentId = $('#departmentId').val();
	
	var pageNum= $('#nextPayOverviewInput').val();
	var startTime = $('#startPayOverview').html();
	var endTime = $('#endPayOverview').html();
	
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime,pageNum:pageNum};
	
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initPayOverviewHtml(returnData.data);
	$('#PayOverview_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousPayOverviewInput').val(returnData.prePage);
	$('#nextPayOverviewInput').val(returnData.nextPage);
	
	$('#curPagePayOverview').html(returnData.curPage+1);
	$('#totalNumberPayOverview').html(returnData.totalNumber);
	$('#totalPagePayOverview').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstPayOverview').attr("disabled","disabled");
		$('#previousPayOverview').attr("disabled","disabled");
	}else {
		$('#firstPayOverview').removeAttr("disabled");
		$('#previousPayOverview').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextPayOverview').attr("disabled","disabled");
		$('#lastPayOverview').attr("disabled","disabled");
	}else {
		$('#nextPayOverview').removeAttr("disabled");
		$('#lastPayOverview').removeAttr("disabled");
	}
	
}

/*
 *  部门薪资总览 分页功能   尾页按钮
 */
function lastPayOverview(){
	url = ctx + '/employeeDimissionController/departmentWages';
	
	var departmentId = $('#departmentId').val();
	
	var pageNum= $('#nextPayOverviewInput').val();
	var startTime = $('#startPayOverview').html();
	var endTime = $('#endPayOverview').html();
	
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime,pageNum:pageNum};
	var  returnData= commonAjaxData(jsonData);
	
	tbodyHtml = initPayOverviewHtml(returnData.data);
	$('#PayOverview_tbody').html(tbodyHtml);
	
	/*
	 * 设置 上下页的隐藏域  值
	 */
	$('#previousPayOverviewInput').val(returnData.prePage);
	$('#nextPayOverviewnInput').val(returnData.nextPage);
	
	$('#curPagePayOverview').html(returnData.curPage+1);
	$('#totalNumberPayOverview').html(returnData.totalNumber);
	$('#totalPagePayOverview').html(returnData.totalPage);
	
	/*
	 * 设置 首页 上一页 无法点击
	 */
	if (returnData.prePage=="-1") {
		$('#firstPayOverview').attr("disabled","disabled");
		$('#previousPayOverview').attr("disabled","disabled");
	}else {
		$('#firstPayOverview').removeAttr("disabled");
		$('#previousPayOverview').removeAttr("disabled");
	}
	/*
	 * 下一页 和 尾页 也不能点击
	 */
	if(returnData.nextPage==returnData.totalPage){
		$('#nextPayOverview').attr("disabled","disabled");
		$('#lastPayOverview').attr("disabled","disabled");
	}else {
		$('#nextPayOverview').removeAttr("disabled");
		$('#lastPayOverview').removeAttr("disabled");
	}
	
}

